﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DotNetNuke.UI.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Security;
using DotNetNuke.Entities.Modules.Actions;
namespace TwentyTech.ToolTips
{
    public partial class view : DotNetNuke.Entities.Modules.PortalModuleBase, IActionable
    {
        private void RegisterScriptBlocks()
        {
            ClientAPI.RegisterClientScriptBlock(Page, "jquery.qtip.min.css", "<link rel=\"stylesheet\" href=\"" + ControlPath + "css/jquery.qtip.min.css\" type=\"text/css\" media=\"screen\" />");
            ClientAPI.RegisterClientScriptBlock(Page, "jquery.qtip.min.js", "<script type=\"text/javascript\" src=\"" + ControlPath + "js/jquery.qtip.min.js\"></script>");
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            RegisterScriptBlocks();

            if (!Page.IsPostBack)
            {
                txtContent.Text = Server.HtmlDecode( ToolTipController.GetToolTipInstance(ModuleId).Content);
                rptToolTips.DataSource = ToolTipController.GetToolTipInstance(ModuleId).ToolTips;
                rptToolTips.DataBind();
            }
        }

        public DotNetNuke.Entities.Modules.Actions.ModuleActionCollection ModuleActions
        {
            get
            {
                ModuleActionCollection actions = new DotNetNuke.Entities.Modules.Actions.ModuleActionCollection();
                actions.Add(GetNextActionID(), "Configuration", String.Empty, String.Empty, "Edit.gif", EditUrl("Edit"), false, SecurityAccessLevel.Edit, true, false);
                return actions;
            }
        }
    }
}